var state=new Array(0,0,0,0,0,0);
var node=new Array("cfj1","cfj2","byc","csb","d","jg");

window.onload=function(){
	def(node,state);
	//loaddata();
}
function change(str,a1){ 
    switch(str){
        case node[0]: 	
        		updata1(str,a1);
        		state[0]=a1;
        		break;
        case node[1]:
        		updata1(str,a1);
        		state[1]=a1;
        		break;
        case node[2]: 
        		updata1(str,a1);
        		state[2]=a1;
        		break;
        case node[3]: 
        		updata1(str,a1);
        		state[3]=a1;
        		break;
        case node[4]: 
        		updata1(str,a1);
        		state[4]=a1;
        		break;
        case node[5]:
        		updata2(str,a1);
				state[5]=a1;
				break;
    }
}
function def(nod,sta){
	for(var i=0;i<nod.length;i++){
		if(1==sta[i]){
			document.getElementById("img"+nod[i]+"yk").style.visibility="visible";
			document.getElementById("img"+nod[i]+"wk").style.visibility="hidden";
		}else{
			document.getElementById("img"+nod[i]+"wk").style.visibility="visible";
			document.getElementById("img"+nod[i]+"yk").style.visibility="hidden";
		}
	}
	document.getElementById("img"+nod[5]+"dkz").style.visibility="hidden";
}
function updata1(str,n){
	if(n==0){
		setTimeout(function(){document.getElementById("img"+str+"wk").style.visibility="visible";},500);
		setTimeout(function(){document.getElementById("img"+str+"yk").style.visibility="hidden";},500);
		document.getElementById("but").style.visibility="visible";
    }else{
    	setTimeout(function(){document.getElementById("img"+str+"wk").style.visibility="hidden";},500);
		setTimeout(function(){document.getElementById("img"+str+"yk").style.visibility="visible";},500);
        document.getElementById("but").style.visibility="visible";
    }
}
function updata2(str,n){
	if(state[5]!=n){
		if(1==n){
			setTimeout(function(){document.getElementById("img"+str+"wk").style.visibility="hidden";},1000);
			setTimeout(function(){document.getElementById("img"+str+"dkz").style.visibility="visible";},1000);
	        setTimeout(function(){document.getElementById("img"+str+"dkz").style.visibility="hidden";},2000);
	        setTimeout(function(){document.getElementById("img"+str+"yk").style.visibility="visible";},2000);
		}else{
			setTimeout(function(){document.getElementById("img"+str+"yk").style.visibility="hidden";},1000);
			setTimeout(function(){document.getElementById("img"+str+"dkz").style.visibility="visible";},1000);
	        setTimeout(function(){document.getElementById("img"+str+"dkz").style.visibility="hidden";},2000);
	        setTimeout(function(){document.getElementById("img"+str+"wk").style.visibility="visible";},2000);
		}
	}
}